#include "main.hh"
#include "pliutil.hh"

void print_top_module()
{
  acc_initialize();
  handle top_mod = null;
  while(top_mod = acc_next_topmod(top_mod))
    io_printf("Top module : %s\n", acc_fetch_name(top_mod));
  acc_close();
}

char *get_top_module_name()
{
  acc_initialize();
  handle top = acc_next_topmod(null);
  char *name;
  if(top)
     name = acc_fetch_name(top);
  else
    name = "";
  acc_close();
  return name;
}

void display_net_name()
{
  handle module;
  handle net;
  /* initialize environment for access routines */
  acc_initialize();
  /* get handle for module */
  module = acc_handle_tfarg(1);
  /*1 is the argument passed to acc_handle_tfarg by $show_nets*/
  /* display names of all nets in the module */
  net = null;
  while(net = acc_next_net(module, net))
    io_printf("Net name is: %s\n", acc_fetch_fullname(net));
  acc_close();
}
  
